package com.dreem.prototype.deepclone;

/**
 * @program: DesignParrtern
 * @description: 测试端
 * @author: Peng
 * @create: 2021-01-28  12:09
 **/
public class Client {
    public static void main(String[] args) throws CloneNotSupportedException {
        DeepProtoType p = new DeepProtoType();
        p.name = "niubility";
        p.deepCloneableTarget = new DeepCloneableTarget("123", "321");

        // 方式一
//        DeepProtoType clone = (DeepProtoType)p.clone();
//
//        System.out.println("p.name = " + p.name + ";p.deepCloneableTrget.hashCode() = " + p.deepCloneableTarget.hashCode());
//        System.out.println("clone.name = " + clone.name + ";clone.deepCloneableTrget.hashCode() = " + clone.deepCloneableTarget.hashCode());

        DeepProtoType p1 = (DeepProtoType)p.deepClone();
        System.out.println("p.name = " + p.name + ";p.deepCloneableTrget.hashCode() = " + p.deepCloneableTarget.hashCode());
        System.out.println("p1.name = " + p1.name + ";p1.deepCloneableTrget.hashCode() = " + p1.deepCloneableTarget.hashCode());

        System.out.println(p.hashCode() + "....." + p1.hashCode());

    }
}
